<?php
declare (strict_types = 1);

namespace app\course\service\coupon\admin;

use app\common\exception\LogicException;
use app\common\service\BaseService;
use app\course\logic\coupon\admin\CouponOffline as CouponOfflineLogic;
use think\facade\Request;

/**
 * 实体卡
 */
class CouponOffline extends BaseService
{
    public function grant()
    {
        $coupon_id = Request::post('coupon_id/d', 0);
        $count     = Request::post('coupon_count/d', 0);
        if (!$coupon_id || !$count) {
            throw new LogicException('生成失败');
        }

        app(CouponOfflineLogic::class)->grant($coupon_id, $count);

        return $this->parseToData([], 1, '生成成功');
    }

}
